/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package vn.webapp.service;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import vn.webapp.dao.ClassesDAO;
import vn.webapp.dao.ClassingDAO;
import vn.webapp.dao.CoursingDAO;
import vn.webapp.dao.TimetablingDAO;
import vn.webapp.dao.ViewingDAO;
import vn.webapp.dto.DataPage;
import vn.webapp.model.Classes;
import vn.webapp.model.Classing;
import vn.webapp.model.ClassingTimeTabling;
import vn.webapp.model.CourseTeacherViewing;
import vn.webapp.model.Timetablingraw;

@Service("viewingService")
public class ViewingServiceImpl implements ViewingService {

    @Autowired 
    private ViewingDAO viewingDAO;

    @Override
    public List<CourseTeacherViewing> list() {
        DataPage<CourseTeacherViewing> dataCourseTeacherViewing = new DataPage<>();
        dataCourseTeacherViewing.setData(viewingDAO.list());
        
        List<CourseTeacherViewing> dataCourseTeachers = dataCourseTeacherViewing.getData();
        return dataCourseTeachers;
    }
    
    @Override
    public List<Timetablingraw> getTimetablingByCourseTeacherId(int courseTeacherId)
    {
        DataPage<Timetablingraw> dataCourseTeacherViewing = new DataPage<>();
        dataCourseTeacherViewing.setData(viewingDAO.getTimetablingByCourseTeacherId(courseTeacherId));
        
        List<Timetablingraw> dataCourseTeachers = dataCourseTeacherViewing.getData();
        return dataCourseTeachers;
    }
}
